package com.joe.demo.chat.server.session;

import io.netty.channel.Channel;

/**
 * @Description
 * @Author gaojw
 * @Date 2024-08-30
 */
public interface ISession {

    /**
     * 绑定会话
     * @param channel
     * @param username
     */
    void bind(Channel channel, String username);

    /**
     * 解除会话
     * @param channel
     * @return
     */
    String unbind(Channel channel);

    /**
     * 获取属性
     * @param channel
     * @param name
     * @return
     */
    Object getAttribute(Channel channel, String name);

    /**
     * 设置属性
     * @param channel
     * @param name
     * @param value
     */
    void setAttribute(Channel channel, String name, String value);

    /**
     * 根据用户名获取channel
     * @param username
     * @return
     */
    Channel getChannel(String username);


}
